<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
		<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
		<script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
		<title>bootstrap</title>
	</head>

	<body>
		<button class="btn btn-primary" id="myModal" onclick="showModal()">切换</button>
		<div class="modal fade" id="hehe">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
						</button>
						<h4 class="modal-title">Modal title</h4>
					</div>
					<div class="modal-body">
						<p>One fine body&hellip;</p>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
						<button type="button" class="btn btn-primary">Save changes</button>
					</div>
				</div>
				<!-- /.modal-content -->
			</div>
			<!-- /.modal-dialog -->
		</div>
		<!-- /.modal -->
		<script>
			$(function() {
							$('#hehe').modal({keyboard: true});
						});
		</script>
		<script>
			$(function() {
							$('#myModal').on('show.bs.modal', function() {
								alert('嘿，我听说您喜欢模态框...');
							})
						});
			function showModal(){
				$('#hehe').modal('show');
			}
		</script>

	</body>

</html>